package com.hava.homework.service;

import org.springframework.stereotype.Component;

import java.util.List;

/**
 * Created by yanfa on 2016/10/16.
 * 创建（Create）、更新（Update）、读取（Retrieve）和删除（Delete）
 */
@Component
public class PrintService {

    Boolean isthrow = false;

    public String create(String value1,int value2,List<String> value3) throws Exception {
        System.out.println("method do create");
        if(isthrow == true)
            throw new Exception("method throw create exception");
        else
            return "return create";
    }

    public String update() throws Exception {
        System.out.println("method do update");
        if(isthrow == true)
            throw new Exception("method throw update exception");
        else
        return "return update";
    }

    public String retrieve() throws Exception {
        System.out.println("method do retrieve");
        if(isthrow == true)
            throw new Exception("method throw retrieve exception");
        else
        return "return retrieve";
    }

    public String delete() throws Exception {
        System.out.println("method do delete");
        if(isthrow == true)
            throw new Exception("method throw delete exception");
        else
        return "return delete";
    }
}
